﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

using JetBrains.Annotations;

using octalforty.Componento.Core.ObjectModel;

namespace octalforty.Componento.Core.Framework
{
    public interface IPackageRepositoryBrowser
    {
        /// <summary>
        /// Returns a collection of all URI schemas supported by this <see cref="IPackageRepositoryBrowser"/>.
        /// </summary>
        /// <remarks>
        /// <see cref="SupportedSchemas"/> must return lower-cased schema names.
        /// </remarks>
        ReadOnlyCollection<string> SupportedSchemas
        { get; }

        /// <summary>
        /// Queries the repository for packages with names matching <paramref name="name"/>
        /// and those satisfying <paramref name="specification"/>.
        /// </summary>
        /// <param name="repositoryUri">URI of the repository</param>
        /// <param name="name">Name or name pattern (like <c>*mvc</c>, <c>autofac.*</c>, <c>*hibernate*</c>, <c>a*mvc</c>)</param>
        /// <param name="specification"></param>
        /// <returns></returns>
        IEnumerable<PackageManifest> GetPackageManifests([NotNull] Uri repositoryUri, [NotNull] string name, [CanBeNull] PackageSpecification specification);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="repositoryUri"></param>
        /// <param name="name"></param>
        /// <param name="specification"></param>
        /// <returns></returns>
        PackageManifest GetPackageManifest([NotNull] Uri repositoryUri, [NotNull] string name, [CanBeNull] PackageSpecification specification);
    }
}
